using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using AxTWSLib;

namespace TradingPlatform.IB.Operations
{
    public class OpenOrders
    {
        private readonly AxTws _tws;
        public List<int> _result;

        public OpenOrders(AxTws tws)
        {
            _tws = tws;

            _tws.openOrderEx += new _DTwsEvents_openOrderExEventHandler(_tws_openOrderEx);
            _result = new List<int>();
        }

        public void RequestOpenOrders()
        {
            _result.Clear();
            _tws.reqOpenOrders();
        }

        void _tws_openOrderEx(object sender, _DTwsEvents_openOrderExEvent e)
        {
            _result.Add(e.orderId);
        }
    }
}